package gqz.mvvm.view;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.SeekBar;

import gqz.mvvm.R;
import gqz.mvvm.view.custom.CircleProgress;

/**
 * Created by Administrator on 2017/12/6.
 */

public class ProgressBarActivity extends BaseActivity {

    private CircleProgress cp;
    private SeekBar sb;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_progress);
        cp = (CircleProgress) findViewById(R.id.progress_cp);
        sb = (SeekBar) findViewById(R.id.progress_sb);
        sb.setOnSeekBarChangeListener(mySBListener);
        cp.setWidth(800);
        cp.setBackgroundColor(Color.rgb(0x61, 0xb6, 0xd5));
        cp.setFrontColor(Color.rgb(0x0D, 0x6D, 0x91));

    }

    SeekBar.OnSeekBarChangeListener mySBListener = new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
//            cp.setSweepAngle(progress);
            cp.setProgress(progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
//            cp.setSweepAngle(seekBar.getProgress());
            cp.setProgress(seekBar.getProgress());
        }
    };
}
